SRCPKGS  = base info rewrite cktsat cnf2aig util itpg ic3 decomp minisat-2.2 luteco
MAIN 	 = main

SRCLIBS  = $(addsuffix .a, $(addprefix lib, $(SRCPKGS)))
PKGS 	 = $(patsubst %, lib/lib%.a ,$(SRCPKGS) )

MAKEOPS  = --no-print-directory 

all: $(PKGS)
	@for pkg in $(SRCPKGS);\
	do\
		cd src/$$pkg;make $(MAKEOPS) ;cd ../../;\
	done
	@cd src/$(MAIN); make $(MAKEOPS)

lib/lib%.a:
	@cd src/$*; make $(MAKEOPS)

clean:
	@for pkg in $(SRCPKGS);\
	do\
		cd src/$$pkg;make $(MAKEOPS) clean;cd ../../;\
	done
	@cd src/$(MAIN); make $(MAKEOPS) clean;

cleanall:
	@for pkg in $(SRCPKGS) $(PKGS3);\
	do\
		cd src/$$pkg;make $(MAKEOPS) clean;cd ../../;\
	done
	@cd src/$(MAIN); make $(MAKEOPS) clean;

ctags:
	@rm -f src/tags
	@for pkg in $(SRCPKGS); \
	do \
		echo "Tagging $$pkg..."; \
		cd src; ctags -a $$pkg/*.cpp $$pkg/*.h; cd ..; \
	done

docs:
	~/bin/doxygen dat/Doxyfile
